package com.model;

import java.util.List;

/**
 * 分页通用类
 */
public class Page<T> {
    private int pageNum; // 当前页码
    private int pageSize; // 每页条数
    private int totalCount; // 总记录数
    private int totalPage; // 总页数
    private List<T> data; // 分页数据

    // 构造方法（自动计算总页数）
    public Page(int pageNum, int pageSize, int totalCount, List<T> data) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.data = data;
        // 计算总页数（向上取整）
        this.totalPage = (totalCount + pageSize - 1) / pageSize;
    }

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public List<T> getData() {
		return data;
	}

	public void setData(List<T> data) {
		this.data = data;
	}

}